{include file='index/_header.html'}

<div class="top-header" style="background-image: url(__STATIC__/themes/__THEME__/img/banner.jpg)">
    <div class="container">
        <h2 class="top-title">{$cats.title}</h2>
        <p class="lead top-description">
            {$cats.subtitle}
            <span class="pull-right"><a href="{:url('index/index')}">首页 </a>  &raquo; <a href="{$cats.nav_href}">{$cats.title}</a></span>
        </p>
    </div>
</div>

<div class="container mtn">

    <div class="row">
        <!-- content -->
        <div class="col-sm-9">
            <!--留言说明-->
            <div class="blog-top">
                {$cats.html_code}
            </div>
            <!--留言表单-->
            <div class="panel panel-default mtn">
                <div class="panel-heading">
                    <h3 class="panel-title">{$cats.title}</h3>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal submit-ajax" role="form" action="{:url('api/message_add')}" method="post">
                        <div class="form-group">
                            <label for="nickname" class="col-sm-1 control-label">*昵称</label>
                            <div class="col-sm-11">
                                <input type="text" id="nickname" name="nickname" class="form-control" placeholder="您的昵称" value="" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="email" class="col-sm-1 control-label">*邮箱</label>
                            <div class="col-sm-11">
                                <input type="text" id="email" name="email" class="form-control" placeholder="联系邮箱" value="" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="msg" class="col-sm-1 control-label">*留言</label>
                            <div class="col-sm-11">
                                <textarea name="msg" id="msg" rows="2" class="form-control" placeholder="留言内容..."></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="captcha" class="col-sm-1 control-label">*验证</label>
                            <div class="col-sm-5">
                                <input type="text" name="captcha" id="captcha" class="form-control" placeholder="请输入验证码"/>
                            </div>
                            <div class="col-sm-6" style="margin-top:3px;">
                                <img src="{:url('api/captcha')}" style="cursor:pointer;" onclick="this.src='{:url('api/captcha')}?'+Math.random();"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">&nbsp;</label>
                            <div class="col-sm-11">
                                <input type="submit" id="submit" value="提交留言" class="btn btn-primary" />
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <!--留言列表-->
            <div class="panel panel-default mtn">
                <div class="panel-heading">
                    <h3 class="panel-title">留言列表</h3>
                </div>
                <div class="panel-body">
                    <div class="row">
                        {php $list = db('message')->where('is_read=1 AND status=1')->order('sort ASC,id DESC')->paginate(8)}
                        {foreach $list as $vo}
                        <div class="col-12 col-md-3" style="margin-bottom: 20px;padding-bottom:15px;border-bottom: 1px solid #eee;">
                            <div class="service-item" style="height: 110px;">
                                <div class="sub-title" style="margin-bottom: 10px;">{$vo.nickname} 于{:get_time_ago($vo['create_time'])}说：</div>
                                <div class="sub-title">{$vo.msg}</div>
                            </div>
                            <div class="sub-title"><strong>回复：</strong>{$vo.reply|default='无'}</div>
                        </div>
                        {/foreach}
                    </div>
                </div>
                <div class="panel-footer">
                    {$list->links()}
                </div>
            </div>

        </div>
        <!-- sidebar -->
        <div class="col-sm-3">

            {!empty $cats['sub_nav']:}
            <div class="panel panel-default">
                <div class="list-group">
                    {foreach $cats['sub_nav'] as $sub}
                    <a href="{$sub.href}" class="list-group-item{if $sub['is_active']:} active{/if}" {$sub.target}>{$sub.title}</a>
                    {/foreach}
                </div>
            </div>
            {/empty}

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">在线交流</h3>
                </div>
                <div class="panel-body">
                    QQ群：<a href="{$site.qq_qun1_link}" target="_blank">{$site.qq_qun1}</a>
                </div>
            </div>

        </div>
    </div>

</div>
{include file='index/_footer.html'}
</body>
</html>